package com.yumi.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 绩效考核实体类
 */
@Data
@TableName("work_performance")
@Schema(description = "绩效考核信息")
public class PerformanceAppraisal {

    /**
     * 考核ID
     */
    @TableId(type = IdType.AUTO)
    @Schema(description = "考核ID")
    private Long id;

    /**
     * 员工ID
     */
    @NotNull(message = "员工ID不能为空")
    @Schema(description = "员工ID", required = true)
    private Long employeeId;

    /**
     * 考核周期（开始日期）
     */
    @NotNull(message = "考核开始日期不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Schema(description = "考核周期开始日期", required = true)
    private LocalDate periodStart;

    /**
     * 考核周期（结束日期）
     */
    @NotNull(message = "考核结束日期不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Schema(description = "考核周期结束日期", required = true)
    private LocalDate periodEnd;

    /**
     * 考核内容
     */
    @NotBlank(message = "考核内容不能为空")
    @Schema(description = "考核内容", required = true)
    private String content;

    /**
     * 考核指标（JSON格式存储）
     */
    @NotBlank(message = "考核指标不能为空")
    @Schema(description = "考核指标（JSON格式存储）", required = true)
    private String indicators;

    /**
     * 考核得分
     */
    @Schema(description = "考核得分（100分制）")
    private BigDecimal score;

    /**
     * 考核等级（A/B/C/D/E）
     */
    @NotBlank(message = "考核等级不能为空")
    @Size(max = 1, message = "考核等级长度不能超过1个字符")
    @Schema(description = "考核等级：A-优秀 B-良好 C-合格 D-需改进 E-不合格", required = true)
    private String grade;

    /**
     * 考核评语
     */
    @Schema(description = "考核评语")
    private String comment;

    /**
     * 评价人ID
     */
    @NotNull(message = "评价人ID不能为空")
    @Schema(description = "评价人ID", required = true)
    private Long evaluatorId;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建时间", accessMode = Schema.AccessMode.READ_ONLY)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "更新时间", accessMode = Schema.AccessMode.READ_ONLY)
    private LocalDateTime updateTime;

    /**
     * 是否删除（0-未删除 1-已删除）
     */
    @TableLogic
    @Schema(description = "是否删除", accessMode = Schema.AccessMode.READ_ONLY)
    private Integer isDeleted;
} 